package com.honglang.module.album.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name="photo")
public class Photo {

	/**
	 * @uml.property  name="id"
	 */
	private Integer id;

	/**
	 * @uml.property  name="description"
	 */
	private String description;

	/**
	 * @uml.property  name="uploadDate"
	 */
	private Date uploadDate;

	/**
	 * @uml.property  name="url"
	 */
	private String url;
	
	
	private String absoluteUrl;
	
	
	private String fileName;
	
	
	private String suffix;
	
	
	public String thumbnailPath(){
		int indexDot = this.url.lastIndexOf(".");
		return this.url.substring(0,indexDot) + "_thumbnail" + this.url.substring(indexDot);
	}
	
	
	/**
	 * Getter of the property <tt>uploadDate</tt>
	 * @return  Returns the uploadDate.
	 * @uml.property  name="uploadDate"
	 */
	@Column
	public Date getUploadDate() {
		return uploadDate;
	}

	/**
	 * Setter of the property <tt>uploadDate</tt>
	 * @param uploadDate  The uploadDate to set.
	 * @uml.property  name="uploadDate"
	 */
	public void setUploadDate(Date uploadDate) {
		this.uploadDate = uploadDate;
	}

	/** 
	 * Getter of the property <tt>Description</tt>
	 * @return  Returns the description.
	 * @uml.property  name="description"
	 */
	@Column
	public String getDescription() {
		return description;
	}

	/** 
	 * Setter of the property <tt>Description</tt>
	 * @param Description  The description to set.
	 * @uml.property  name="description"
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * Getter of the property <tt>id</tt>
	 * @return  Returns the id.
	 * @uml.property  name="id"
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
		return id;
	}

	/**
	 * Setter of the property <tt>id</tt>
	 * @param id  The id to set.
	 * @uml.property  name="id"
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * Getter of the property <tt>url</tt>
	 * @return  Returns the url.
	 * @uml.property  name="url"
	 */
	@Column
	public String getUrl() {
		return url;
	}

	/**
	 * Setter of the property <tt>url</tt>
	 * @param url  The url to set.
	 * @uml.property  name="url"
	 */
	public void setUrl(String url) {
		this.url = url;
	}

	
	@Column
	public String getAbsoluteUrl() {
		return absoluteUrl;
	}

	public void setAbsoluteUrl(String absoluteUrl) {
		this.absoluteUrl = absoluteUrl;
	}

	@Column
	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	@Column
	public String getSuffix() {
		return suffix;
	}

	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}
	
	
	

}
